import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';

@Injectable()
export class FocusService {
    constructor(@InjectModel('Focus') private readonly focusModel) {}
    async find(where = {}, sort = { sort: 1, createdTime: -1 }, fields = null) {
        return await this.focusModel.find(where, fields).sort(sort);
    }
    async create(focusInfo) {
        return await this.focusModel.create(focusInfo);
    }
    async update(focusInfo) {
        return await this.focusModel.updateOne({ _id: focusInfo._id }, focusInfo);
    }
    async delete(focusInfo) {
        return await this.focusModel.deleteOne(focusInfo);
    }
}
